package org.jeecg.modules.home.monitoring.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.home.monitoring.entity.MonitoringMap;
import org.jeecg.modules.home.monitoring.entity.MonitoringPile;
import org.jeecg.modules.home.monitoring.entity.MonitoringStation;
import org.jeecg.modules.home.monitoring.service.MonitoringService;

import org.jeecg.modules.param.station.entity.BikeStation;
import org.jeecg.modules.param.station.vo.HomeReport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 月月鸟
 */
@Api(tags="首页监控")
@RestController
@RequestMapping("/home/monitoring")
@Slf4j
public class MonitoringController{
    @Autowired
    private MonitoringService monitoringService;

    /**
     * 首页展示
     *
     * @param monitoringStation
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    @ApiOperation(value="首页展示", notes="首页展示，如有区域条件，传入id,id,id拼接字符串")
    @GetMapping(value = "/homeList")
    public Result<?> homeList(MonitoringStation monitoringStation,
                              @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                              @RequestParam(name="pageSize", defaultValue="40") Integer pageSize,
                              HttpServletRequest req) {
        return monitoringService.homeList(monitoringStation,pageNo,pageSize);
    }
    ///**
    // * 首页地图
    // *
    // * @param bikeStation
    // * @return
    // */
    //@ApiOperation(value="首页地图", notes="首页地图，如有区域条件，传入id,id,id拼接字符串")
    //@PostMapping(value = "/homeMapList")
    //public Result<?> homeMapList(@RequestBody BikeStation bikeStation) {
    //    return Result.OK(monitoringService.homeMapList(bikeStation));
    //}
    /**
     * 首页地图
     *
     * @param bikeStation
     * @param req
     * @return
     */
    @ApiOperation(value="首页地图", notes="首页地图，如有区域条件，传入id,id,id拼接字符串")
    @PostMapping(value = "/homeMapList")
    public Result<?> homeMapList(@RequestBody BikeStation bikeStation,
                              HttpServletRequest req) {
        List<MonitoringStation> monitoringMaps = monitoringService.homeMapList(bikeStation);
        return Result.OK(monitoringMaps);
    }
    /**
     * 车桩详情
     *
     * @param monitoringPile
     * @param req
     * @return
     */
    @ApiOperation(value="首页展示-车桩详情", notes="首页展示-车桩详情")
    @GetMapping(value = "/homeListById")
    public Result<?> homeListById(MonitoringPile monitoringPile,
                                  HttpServletRequest req) {
        return monitoringService.homeListById(monitoringPile);
    }
    /**
     * 首页 情况报告

     * @return
     */
    @ApiOperation(value="首页 情况报告", notes="首页 情况报告")
    @GetMapping(value = "/homeReport")
    public Result<?> homeReport(HttpServletRequest req) {
        return monitoringService.homeReport();
    }
}
